//
//  XLHistoryCell
//  History
//
//  Created by 于鹏 on 2017/8/14.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import "XLHistoryCell.h"
#import "XLCellLabel.h"
#import "XLHistoryModel.h"
//#import <XLBaseModule/XLAppMacro.h>
//#import <BaseModule/UIView+XLVisuals.h>
#import "XLAppMacro.h"
#import "UIView+XLVisuals.h"
@interface XLHistoryCell ()
@property (weak, nonatomic) IBOutlet UIView *containerView;
@property (weak, nonatomic) IBOutlet UIView *topView;

@property (weak, nonatomic) IBOutlet XLCellLabel *nameLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *genderLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *ageLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *typeLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *timeLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *hospitalLabel;
@property (weak, nonatomic) IBOutlet XLCellLabel *doctorLabel;


@end

@implementation XLHistoryCell



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
//    self.containerView.layer.cornerRadius = 8;
//    self.containerView.layer.borderColor = kRGB(229, 233, 236).CGColor;
//    self.containerView.layer.borderWidth = 0.5;
    
    [self.containerView xl_cornerRadius:8 strokeSize:0.5 color:kRGB(229, 233, 236)];
    
}

+ (XLBaseTableViewCell *)cellWithIdentifier:(NSString *)cellIdentifier tableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    XLHistoryCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
    //去掉选中时的cell背景色
    cell.selectedBackgroundView = [UIView new];
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
    }
    return self;
}

- (void)setupUI {
//    [super setupUI];
    self.backgroundColor = kBackground_color;
}

- (void)setModel:(XLHistoryModel *)model {
    _model = model;
    self.nameLabel.text = [NSString stringWithFormat:@"姓名:%@",model.PatientName];
    self.genderLabel.text = [NSString stringWithFormat:@"性别:%@",model.gender];
    self.ageLabel.text = [NSString stringWithFormat:@"年龄(岁):%@",model.age];
    self.typeLabel.text = [NSString stringWithFormat:@"呼叫原因:%@",model.firstAidType];
    self.timeLabel.text = [NSString stringWithFormat:@"发病时间:%@",model.morbidityTime];
    self.hospitalLabel.text = [NSString stringWithFormat:@"接车医院:%@",model.hospital];
    self.doctorLabel.text = [NSString stringWithFormat:@"负责医生:%@",model.doctorName];
    for (UIView *subView in self.topView.subviews) {
        if ([subView isKindOfClass:[XLCellLabel class]]) {
            XLCellLabel *label = (XLCellLabel *)subView;
            label.numberOfLines = 1;
            label.fontType = XLLabelFontDetail;
        }
    }
                           
}

//选中时 不改变背景颜色
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    self.containerView.backgroundColor = kXLWhiteColor;
    self.topView.backgroundColor = kXLWhiteColor;
}

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
    [super setHighlighted:highlighted animated:animated];
    self.containerView.backgroundColor = kXLWhiteColor;
    self.topView.backgroundColor = kXLWhiteColor;

}

@end
